package com.project.controller;

import com.project.bean.ClassBean;
import com.project.service.IClassService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("class")
public class ClassController {
    @Autowired
    private IClassService service;
    @RequestMapping("findAll")
    public List<ClassBean> findAll(){
       return service.findAll();

    }
    @RequestMapping("addClass")
    public String addClass(ClassBean classBean){
        service.addClass(classBean);
        return "ok";
    }
    @RequestMapping("delClass")
    public String delClass(Integer classId){
        boolean flag = service.delClass(classId);
        if (flag) {
            return "ok";
        }
        return "no";
    }
}
